<template>
  <view class="flex-col page">
    <view class="flex-col flex-auto group_2">
      <text class="self-start text_5">我的实验室</text>
	  
      <view class="flex-row justify-between items-center section" @click="navTo('/pages/sysguanli2/sysguanli2')">
		  
        <view class="flex-col space-y-8">
          <text class="text_6">{{nickname}}的实验室</text>
          <view class="flex-row items-center">
            <text class="font_2">{{rooms.length}}个房间</text>
            <view class="section_2"></view>
            <text class="font_2 text_7">{{equips.length}}个设备</text>
          </view>
        </view>
		
        <!-- <image class="image_6" src="../../static/images/2f1c2f7b5cd59dd7879633d1b27011e9.png" /> -->
      </view>
	  
      <!-- <image class="self-end image_8" src="../../static/images/ee7895e69d47f1c5745cfdfbae68fa4b.png" /> -->
    </view>
  </view>
</template>

<script>
	//获取账号信息接口
	import { _getuserinfo } from '@/service/user.js'
	//获取用户所有房间列表接口
	import { _getrooms } from '@/service/room.js'
	//获取用户绑定设备列表接口
	import { _getequiplist } from '@/service/equip.js'
	//获取用户绑定的设备列表(绑定加共享)
	import { _getequiplistall } from '@/service/equip.js'
	//查询该用户得到的所有共享设备接口
	import { _getsharingequips } from '@/service/sharingequip.js'
  export default {
    components: {},
    data() {
      return {
		  nickname:'',
		  account_user:'',
		  password_user:'',
		  rooms:[],
		  equips:[]
	  };
    },
	onLoad(){
		let newdata;
		try {
			const value = uni.getStorageSync('userInfo');
			if (value != null) {
				this.nickname = value.nickname
				this.account_user = value.accountNum
				this.password_user = value.password
			}
		} catch (e) {
			console.error(e);
		}
	},
	onShow() {
		this.getrooms();
		this.getequipsinfo();
	},
    methods: {
		navTo(url){
			uni.navigateTo({
				url:url,
				success(res) {
					console.log('成功啦',res);
				},
				fail(err) {
					console.log('失败啦',err);
				}
			})
		},
		async getrooms(){
			let data={
				account_user:this.account_user
			}
			let res = await _getrooms(data);
			this.rooms = res.data;
			console.log(this.rooms);
		},
		async getequipsinfo(){
			let data={
				account_user:this.account_user
			}
			let res = await _getequiplistall(data)
			this.equips = res.data
			console.log(this.equips)
		}
	},
  };
</script>

<style scoped lang="scss">
  .page {
    background-color: #ffffff;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    .group_2 {
      padding: 29.17rpx 0 77.08rpx;
      overflow-y: auto;
      .text_5 {
        margin-left: 66.67rpx;
        color: #000000;
        font-size: 31.25rpx;
        font-family: SourceHanSansCN;
        line-height: 29.17rpx;
      }
      .section {
        margin-top: 54.17rpx;
        padding: 8.33rpx 16.67rpx 12.5rpx 66.67rpx;
        background-color: #ffffff;
        border: solid 1.04rpx #a6a6a6;
        .space-y-8 {
          & > view:not(:first-child),
          & > text:not(:first-child),
          & > image:not(:first-child) {
            margin-top: 16.67rpx;
          }
          .text_6 {
            color: #000000;
            font-size: 41.67rpx;
            font-family: SourceHanSansCN;
            line-height: 38.54rpx;
          }
          .font_2 {
            font-size: 20.83rpx;
            font-family: AlibabaPuHuiTi;
            line-height: 18.75rpx;
            color: #00000080;
          }
          .section_2 {
            margin-left: 4.17rpx;
            background-color: #a6a6a6;
            width: 2.08rpx;
            height: 29.17rpx;
          }
          .text_7 {
            margin-left: 16.67rpx;
            line-height: 19.79rpx;
          }
        }
        .image_6 {
          width: 50rpx;
          height: 50rpx;
        }
      }
      .image_8 {
        margin-right: 43.75rpx;
        margin-top: 779.17rpx;
        border-radius: 50%;
        width: 93.75rpx;
        height: 93.75rpx;
      }
    }
  }
</style>